<%@page import="java.util.List"%>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>查看部门</title>
</head>

<body>
	<style type="text/css"> 
#mytable {   
    padding: 0;
    margin: 0;   
    border-collapse:collapse;
}

td {
    border: 1px solid #C1DAD7;   
    background: #fff;
    font-size:11px;
    padding: 6px 6px 6px 12px;
    color: #4f6b72;
}

td.alt {
    background: #F5FAFA;
    color: #797268;
}

</style> 
<form id="form1" name="form1" action="" method="post">
<div>
	<fieldset style="width: 90%;">
					<legend>
						<span><b>部门基本信息</b></span>
					</legend>
					<table width="100%" cellspacing="1" align="center"  border="0" bordercolor="blue">
							<tr height="29">
								<td class="alt" align="right" class="tdBackGorund" width="5%">上级部门：</td>
								<td style="text-align: left;  padding-left: 3px;padding-top: 5px;" width="15%" colspan="3">
									<input id="m2" name="m2" type="text" value="${dept.m2}" readonly="readonly"/>
									<input id="m1" name="m1" type="hidden" value="${dept.m1}" />
								</td>	
								</tr>						
					
							<tr height="29">	
									<td class="alt" align="right" class="tdBackGorund" width="5%">部门名称：</td>
								<td style="text-align: left;  padding-left: 3px;padding-top: 5px;" width="15%">
								    <input id="m3" name="m3" type="text" value="${dept.m3}"  readonly="readonly"/><font style="color: red">*</font>									
								</td>
									<td class="alt" align="right" class="tdBackGorund" width="5%">部门顺序：</td>
								<td style="text-align: left;  padding-left: 3px;padding-top: 5px;" width="15%">
								    <input id="p12" name="p12" type="text" value="${dept.p12}" readonly="readonly"/>									
								</td>							
							
							</tr>						
					
							<tr height="29">								
								<td class="alt" align="right" class="tdBackGorund" width="5%">部门类别：</td>
								<td style="text-align: left;  padding-left: 3px;padding-top: 5px;">
									<select id="z3" name="z3" style="width: 122px" disabled="disabled">
										<option value="1">行业部门</option>
										<option value="2">工业企业</option>
										<option value="3">批发零售</option>
										<option value="4">住宿餐饮</option>										
									</select>
									<script>
									jQuery("#z3").val('${dept.z3}');
										</script>
								</td>
								<td class="alt" align="right" class="tdBackGorund" width="5%">级 &nbsp;&nbsp;&nbsp;&nbsp;别：</td>
								<td style="text-align: left;  padding-left: 3px;padding-top: 5px;">
									<select id="z4" name="z4" style="width: 122px" disabled="disabled">
										<option value="1">省</option>
										<option value="2">市</option>
										<option value="3">县</option>																		
									</select>
									<script>
											jQuery("#z4").val('${dept.z4}');
										</script>
								</td>
							</tr>
							<tr height="29">
								<td class="alt" align="right" class="tdBackGorund" width="5%">部门模板：</td>
								<td style="text-align: left;  padding-left: 3px;padding-top: 5px;"width="15%"> 
									<input id="m4" name="m4" type="text" value="${dept.m4}" readonly="readonly"/>
								</td>
								<td class="alt" align="right" class="tdBackGorund" width="5%">部门邮编：</td>
								<td style="text-align: left;  padding-left: 3px;padding-top: 5px;"width="15%"> 
									<input id="m6" name="m6" type="text" value="${dept.m6}" readonly="readonly"/>
								</td>	
							</tr>
								<tr height="29">
								<td class="alt" align="right" class="tdBackGorund" width="5%">部门地址：</td>
								<td style="text-align: left;  padding-left: 3px;padding-top: 5px;"width="15%"> 
									<input id="m5" name="m5" type="text" value="${dept.m5}" readonly="readonly"/>
								</td>
								<td class="alt" align="right" class="tdBackGorund" width="5%">联系人：</td>
								<td style="text-align: left;  padding-left: 3px;padding-top: 5px;"width="15%"> 
									<input id="m9" name="m9" type="text" value="${dept.m9}" readonly="readonly"/>
								</td>	
							</tr>
								<tr height="29">
								<td class="alt" align="right" class="tdBackGorund" width="5%">联系电话：</td>
								<td style="text-align: left;  padding-left: 3px;padding-top: 5px;"width="15%"> 
									<input id="m10" name="m10" type="text" value="${dept.m10}" readonly="readonly"/>
								</td>
								<td class="alt" align="right" class="tdBackGorund" width="5%">备用电话：</td>
								<td style="text-align: left;  padding-left: 3px;padding-top: 5px;"width="15%"> 
									<input id="m11" name="m11" type="text" value="${dept.m11}" readonly="readonly" />
								</td>	
							</tr>
							<tr height="29">
								<td class="alt" align="right" class="tdBackGorund" width="5%">QQ号：</td>
								<td style="text-align: left;  padding-left: 3px;padding-top: 5px;"width="15%"> 
									<input id="m12" name="m12" type="text" value="${dept.m12}" readonly="readonly"/>
								</td>
								<td class="alt" align="right" class="tdBackGorund" width="5%">微信号：</td>
								<td style="text-align: left;  padding-left: 3px;padding-top: 5px;"width="15%"> 
									<input id="m13" name="m13" type="text" value="${dept.m13}" readonly="readonly"/>
								</td>	
							</tr>
							<tr height="29">
								<td class="alt" align="right" class="tdBackGorund" width="5%">部门简介：</td>
								<td style="text-align: left;  padding-left: 3px;padding-top: 5px;">
									  <textarea name="m7" style="width:98%; height:160px;" readonly="readonly">${dept.m7}</textarea>
								</td>
								<td class="alt" align="right" class="tdBackGorund" width="5%">采集部门：</td>
								<td style="text-align: left;  padding-left: 3px;padding-top: 5px;"width="15%" > 
									<input name="p31" type="radio" value="0"  ${dept.p31 ne '1'?'checked':''} readonly="readonly"/>否
									<input name="p31"  type="radio"  value="1" ${dept.p31 eq '1'?'checked':''} readonly="readonly"/>是
								</td>
						</tr>
						<tr> 
						    <td colspan="4" align="center"><input type="button" value="保存" onclick="updateDept()"/><input type="button" value="返 回" onclick="returnMain()"/></td>
						</tr>
					</table>
				</fieldset>			
</div>
  
</table> 
</form>
<script type="text/javascript">

function updateDept(){
	var flag = true;
//	flag = validate();
	if(flag){
		var formObj = document.getElementById("form1");
		formObj.action=ctx+'/ufmDept/updateDept';
		formObj.submit();
	}
}

function returnMain(){
	var formObj = document.getElementById("form1");
	formObj.action=ctx+'/ufmDept/findAll';
	formObj.submit();
}

function validate(){
	var flag = true;
    var myreg= /^([a-zA-Z0-9]+[_|\_|\.|\-]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.|\-]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
    var mobilephoneReg = /^\d{11}$/;
    var telephoneReg = /^\d{3}-\d{8}|\d{4}-\d{7}|\d{7,}$/;
    var userloginReg = /^([a-zA-Z0-9]+[_|\_|\.|\-]?)*[a-zA-Z0-9]$/;
  	if(jQuery("#m3").val() == ""){
		alert("请填写部门名称");
		return false;
	}
	if(jQuery("#userLogin").val() == ""){
		alert("请填写账号");
		return false;
	}else{
		if(!userloginReg.test(jQuery("#userLogin").val())){
			alert("请正确填写登录名称(可以由字母数字下划线组合)");
			return false;
		}
	}
	if(jQuery("#email").val() == ""){
		alert("请填写邮箱");
		return false;
	}
	if(jQuery("#email").val()!=""){
		if(!myreg.test(jQuery("#email").val())){
			alert("请按正确的邮箱格式填写");
			return false;
		}
	}
	if(jQuery("#mobilephone").val()!=""){
		if(!mobilephoneReg.test(jQuery("#mobilephone").val())){
			alert("请正确填写手机号码");
			return false;
		}
	}
	if(jQuery("#hometel").val()!=""){
		if(!telephoneReg.test(jQuery("#hometel").val())){
			alert("请正确填写住宅电话(格式：010-12345678 或 12345678)");
			return false;
		}
	}
	if(jQuery("#worktel").val()!=""){
		if(!telephoneReg.test(jQuery("#worktel").val())){
			alert("请正确填写工作电话(格式：010-12345678 或 12345678)");
			return false;
		}
	}
	return true;
  }
  
</script>
</body>
</html>
